package com.ruoyi.laiwu.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.ruoyi.laiwu.domain.UmEventLwq;
import com.ruoyi.laiwu.domain.vo.UmEventLwqVo;
import com.ruoyi.common.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * 案件主Mapper接口
 *
 * @author ruoyi
 * @date 2023-12-12
 */

@DS("slave")
public interface UmEventLwqMapper extends BaseMapperPlus<UmEventLwqMapper, UmEventLwq, UmEventLwqVo> {


    List<Map<String,Object>> queryByGroup(String questionDesc);

    List<Map<String,Object>> queryListMap();

    @Select("select * from (select SUBSTRING_INDEX(area_name,'-',-1) `name` ,COUNT(1) value from um_event_lwq where case_status != -1  GROUP BY `name`) a where name not like '%区%' order by value desc")
    List<Map<String,Object>> ajgl_sjfb_jdb();

    @Select("select * from (select SUBSTRING_INDEX(SUBSTRING_INDEX(area_name,'-',2),'-',-1) `name` ,COUNT(1) value from um_event_lwq where case_status != -1 GROUP BY `name`) a order by value desc")
    List<Map<String, Object>> ajgl_sjfb_qxbm();

    @Select("select SUBSTRING(name,6,5) name,value from (select SUBSTRING(report_time,1,10) name,COUNT(1) value from um_event_lwq where case_status != -1 GROUP BY name order by name desc LIMIT 30) a ")
    List<Map<String, Object>> jxhzl_sjzsqsfx_r();

    @Select("select SUBSTRING(report_time,1,4) name,COUNT(1) value from um_event_lwq where case_status != -1 GROUP BY name order by name desc LIMIT 30")
    List<Map<String, Object>> jxhzl_sjzsqsfx_n();
}
